/*
 * Copyright (C), 2014-2016, org.esaydev
 * FileName: BaseRequestDto.java
 * Author:   jian
 * Date:     2016年3月16日 下午3:55:24
 */
package org.easydev.wechat.client.dto.base;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;

/**
 * <Description> 微信请求全局参数，所有请求微信的参数继承此对象<br>
 */
public class BaseParam {

    /**
     * 微信令牌
     */
    @JSONField(name = "access_token")
    private String accessToken;

    /**
     * get accessToken
     * 
     * @return Returns the accessToken.<br>
     */
    public String getAccessToken() {
        return accessToken;
    }

    /**
     * set accessToken
     * 
     * @param accessToken The accessToken to set. <br>
     */
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public static void main(String[] args) {
        AccessToken dto = new AccessToken();
        dto.setAccessToken("11111");
        dto.setSecret("111111111111");
        System.out.println(JSON.toJSON(dto));

        JSONObject a = new JSONObject();
        a.put("access_token", "111111");
        a.put("grant_type", "client_credential");
        a.put("secret", "11111122222222");
        System.out.println(JSON.parseObject(a.toJSONString(), AccessToken.class).getAccessToken());
        System.out.println(JSON.parseObject(a.toJSONString(), BaseParam.class).getAccessToken());
    }
}
